package gamegui;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JLabel;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextPane;
import javax.swing.JButton;

import java.awt.Color;
import java.util.ArrayList;
import javax.swing.SwingConstants;


public class ViewHighScores extends JPanel {

	/**
	 * Create the panel.
	 */
	final JButton backToMainButton;
	final Dimension dim = new Dimension (1100, 730);
	final Dimension backSize = new Dimension(100, 100);
	final Point backLoc = new Point(15, 550);
	public ViewHighScores(ArrayList<Integer> highScoresList, ArrayList<String> usernameListOfHighScores) {
		
		//setLayout(null);
		setPreferredSize(dim);
		ImageIcon mainImage = new ImageIcon("screen.jpg");        
        JLabel label = new JLabel("", mainImage, JLabel.CENTER);
        label.setLocation(0, 0);
        label.setPreferredSize(dim);	
        
		JLabel lblHighScores = new JLabel("High Scores");
		lblHighScores.setForeground(Color.WHITE);
		lblHighScores.setFont(new Font("Sylfaen", Font.BOLD | Font.ITALIC, 24));
		lblHighScores.setBounds(170, 31, 160, 55);
		label.add(lblHighScores);
		
		JLabel first = new JLabel("1.) "+ usernameListOfHighScores.get(0) + "  Score: " + highScoresList.get(0 ));
		first.setHorizontalAlignment(SwingConstants.LEFT);
		first.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
		first.setForeground(new Color(255, 127, 80));
		first.setBounds(67, 100, 271, 26);
		label.add(first);
		
		JLabel second = new JLabel("2.) "+ usernameListOfHighScores.get(1) + "     Score: " + highScoresList.get(1));
		second.setHorizontalAlignment(SwingConstants.LEFT);
		second.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
		second.setForeground(new Color(255, 127, 80));
		second.setBounds(67, 150, 291, 38);
		label.add(second);
		
		JLabel third = new JLabel("3.) "+ usernameListOfHighScores.get(2) + "      Score: " + highScoresList.get(2));
		third.setHorizontalAlignment(SwingConstants.LEFT);
		third.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
		third.setForeground(new Color(255, 127, 80));
		third.setBounds(67, 200, 284, 29);
		label.add(third);
		
		JLabel fourth = new JLabel("4.) "+ usernameListOfHighScores.get(3) + "     Score: " + highScoresList.get(3));
		fourth.setBackground(new Color(75, 0, 130));
		fourth.setHorizontalAlignment(SwingConstants.LEFT);
		fourth.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
		fourth.setForeground(new Color(255, 127, 80));
		fourth.setBounds(67, 250, 284, 26);
		label.add(fourth);
		
		JLabel fifth = new JLabel("5.) "+ usernameListOfHighScores.get(4) + "      Score: " + highScoresList.get(4));
		fifth.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));
		fifth.setForeground(new Color(255, 127, 80));
		fifth.setBounds(67, 300, 284, 26);
		label.add(fifth);
		
		backToMainButton = new JButton("Back ");
		backToMainButton.setFont(new Font("Tahoma", Font.BOLD, 15));
		backToMainButton.setLocation(backLoc);
		backToMainButton.setSize(new Dimension(80, 100));
		backToMainButton.setBounds(258, 500, 141, 45);
		label.add(backToMainButton);
		
		add(label);
		repaint();
	}
	
	public void paintComponent (Graphics page)
	{
		super.paintComponent(page);
		//page.drawRect(400, 400, 60, 15);
	}
	public JButton getBackToMainButton(){
		return backToMainButton;
	}
}
